<template>
    <div>
      <home-header :headercity="city"></home-header>
      <HomeSwiper :headerswiper="swiperList"></HomeSwiper>
      <HomeIcons :homeicon="iconList"></HomeIcons>
      <HomeRecommend :recommendlist="recommendlist"></HomeRecommend>
      <Homeweekend :weekendlist="weekendlist"></Homeweekend>
    </div>
</template>
<script>
import HomeHeader from "./components/Header"
import HomeSwiper from "./components/swiper"
import HomeIcons from "./components/icons"
import HomeRecommend from "./components/recommend"
import Homeweekend from "./components/weekend"
import axios from "axios"
export default {
    name:"Home",
    data(){
        return{
            city:'',
            swiperList:[],
            iconList:[],
            recommendlist:[],
            weekendlist:[]

        }
    },
    components:{
     HomeHeader,
     HomeSwiper,
     HomeIcons,
     HomeRecommend,
     Homeweekend
    },
    mounted() {
        this.getHomeInfo();
    },
    methods: {
        getHomeInfo (){
            axios.get("/api/index.json").then(this.getHomeInfoSucc)
        },
        getHomeInfoSucc(res){
           res=res.data;
           if(res.ret&&res.data){
            this.city=res.data.city;
            this.swiperList=res.data.SwiperList;
            this.iconList=res.data.iconList;
            this.recommendlist=res.data.recommendList,
            this.weekendlist=res.data.weekendList
            console.log(res.data)
           }
        }
    },
}
</script>
<style lang="stylus" scope>
    
</style>